package cn.wrl.order.fallback.itemservice;

import cn.wrl.item.pojo.vo.MyCommentVO;
import cn.wrl.pojo.PagedGridResult;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Collections;
import java.util.Map;

/**
 * 降级逻辑
 */
@Slf4j
@Component
@RequestMapping("JJJBBBAAACCCDDD")
public class ItemCommonFallback implements ItemCommonFeignClient {


    @Override
//    @HystrixCommand   //多级降级
    public PagedGridResult queryMyComments(String userId, Integer page, Integer pageSize) {
        MyCommentVO myCommentVO = new MyCommentVO();
        myCommentVO.setContent("正在加载中");
        PagedGridResult result = new PagedGridResult();
        result.setRows(Collections.singletonList(myCommentVO));
        result.setPage(1);
        result.setTotal(1);
        return result;
    }

    @Override
    public void saveComments(Map<String, Object> map) {
        log.info("saveComments降级逻辑.");
    }
}
